<template>
  <tr>
    <td><input type="checkbox" name="" id="" :checked="obj.checked" @change="$emit('change-checked',ind)" /></td>
    <td>{{ obj.name }}</td>
    <td>{{ obj.price }}</td>
    <td>
      <button @click="add">+</button>
      {{ obj.num }}
      <button @click="aqq">-</button>
    </td>
    <td>{{ jj }}</td>
    <td><button @click="$emit('remove-event', obj)">删除</button></td>
  </tr>
</template>

<script>
export default {
  components: {},
  props: {
    // 每个接收的都这么写
    obj: {
      type: Object,
      required: true,
    },
    ind: {
      type: Number,
      required: true,
    },
  },
  data() {
    return {};
  },
  computed: {
    jj() {
      return this.obj.price * this.obj.num;
    },
  },
  watch: {},
  created() {},
  methods: {
    // 传输方法 和参数  下面得加this
    add() {
      this.$emit("add", this.ind);
    },
    aqq() {
      this.$emit("aqq", this.ind);
    },
  },
};
</script>

<style scoped></style>
